+Fri May 7 00:41:46 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtktearoffmenuitem.h:
+ * gtk/gtktearoffmenuitem.c: Make the tearoff
+ functionality model/view, the tearoffmenuitem being
+ the view and the tearoff_state property of the menu
+ being the model. (#101185, Owen Taylor)
+
+ * gtk/gtkmenu.c: Add a tearoff_state property.
+
Thu May 6 23:52:13 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
+Fri May 7 00:41:46 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtktearoffmenuitem.h:
+ * gtk/gtktearoffmenuitem.c: Make the tearoff
+ functionality model/view, the tearoffmenuitem being
+ the view and the tearoff_state property of the menu
+ being the model. (#101185, Owen Taylor)
+
+ * gtk/gtkmenu.c: Add a tearoff_state property.
+
Thu May 6 23:52:13 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
+Fri May 7 00:41:46 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtktearoffmenuitem.h:
+ * gtk/gtktearoffmenuitem.c: Make the tearoff
+ functionality model/view, the tearoffmenuitem being
+ the view and the tearoff_state property of the menu
+ being the model. (#101185, Owen Taylor)
+
+ * gtk/gtkmenu.c: Add a tearoff_state property.
+
Thu May 6 23:52:13 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
+Fri May 7 00:41:46 2004 Matthias Clasen <maclas@gmx.de>
+
+ * gtk/gtktearoffmenuitem.h:
+ * gtk/gtktearoffmenuitem.c: Make the tearoff
+ functionality model/view, the tearoffmenuitem being
+ the view and the tearoff_state property of the menu
+ being the model. (#101185, Owen Taylor)
+
+ * gtk/gtkmenu.c: Add a tearoff_state property.
+
Thu May 6 23:52:13 2004 Matthias Clasen <maclas@gmx.de>
Merge from 2.4:
enum {
PROP_0,
+ PROP_TEAROFF_STATE,
PROP_TEAROFF_TITLE
};
P_("Tearoff Title"),
P_("A title that may be displayed by the window manager when this menu is torn-off"),
"",
- G_PARAM_READABLE | G_PARAM_WRITABLE));
+ G_PARAM_READWRITE));
+
+ /**
+ * GtkMenu:tearoff-state:
+ *
+ * A boolean that indicates whether the menu is torn-off.
+ *
+ * Since: 2.6
+ **/
+ g_object_class_install_property (gobject_class,
+ PROP_TEAROFF_STATE,
+ g_param_spec_boolean ("tearoff-state",
+ P_("Tearoff State"),
+ P_("A boolean that indicates whether the menu is torn-off"),
+ FALSE,
+ G_PARAM_READWRITE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("vertical-padding",
switch (prop_id)
{
+ case PROP_TEAROFF_STATE:
+ gtk_menu_set_tearoff_state (menu, g_value_get_boolean (value));
+ break;
case PROP_TEAROFF_TITLE:
gtk_menu_set_title (menu, g_value_get_string (value));
break;
switch (prop_id)
{
+ case PROP_TEAROFF_STATE:
+ g_value_set_boolean (value, gtk_menu_get_tearoff_state (menu));
+ break;
case PROP_TEAROFF_TITLE:
g_value_set_string (value, gtk_menu_get_title (menu));
break;
menu->tearoff_scrollbar = NULL;
menu->tearoff_adjustment = NULL;
}
+
+ g_object_notify (G_OBJECT (menu), "tearoff_state");
}
}
static void
gtk_tearoff_menu_item_init (GtkTearoffMenuItem *tearoff_menu_item)
{
- tearoff_menu_item->torn_off = FALSE;
}
static void
GtkRequisition *requisition)
{
GtkTearoffMenuItem *tearoff;
-
+
tearoff = GTK_TEAROFF_MENU_ITEM (widget);
requisition->width = (GTK_CONTAINER (widget)->border_width +
requisition->height = (GTK_CONTAINER (widget)->border_width +
widget->style->ythickness) * 2;
- if (tearoff->torn_off)
+ if (GTK_IS_MENU (widget->parent) && GTK_MENU (widget->parent)->torn_off)
{
requisition->height += ARROW_SIZE;
}
else
gdk_window_clear_area (widget->window, area->x, area->y, area->width, area->height);
- if (tearoff_item->torn_off)
+ if (GTK_IS_MENU (widget->parent) && GTK_MENU (widget->parent)->torn_off)
{
gint arrow_x;
return FALSE;
}
-static gint
-gtk_tearoff_menu_item_delete_cb (GtkMenuItem *menu_item, GdkEventAny *event)
-{
- gtk_tearoff_menu_item_activate (menu_item);
- return TRUE;
-}
-
static void
gtk_tearoff_menu_item_activate (GtkMenuItem *menu_item)
{
GtkTearoffMenuItem *tearoff_menu_item = GTK_TEAROFF_MENU_ITEM (menu_item);
- tearoff_menu_item->torn_off = !tearoff_menu_item->torn_off;
- gtk_widget_queue_resize (GTK_WIDGET (menu_item));
-
if (GTK_IS_MENU (GTK_WIDGET (menu_item)->parent))
{
GtkMenu *menu = GTK_MENU (GTK_WIDGET (menu_item)->parent);
- gboolean need_connect;
- need_connect = (tearoff_menu_item->torn_off && !menu->tearoff_window);
-
- gtk_menu_set_tearoff_state (GTK_MENU (GTK_WIDGET (menu_item)->parent),
- tearoff_menu_item->torn_off);
-
- if (need_connect)
- g_signal_connect_swapped (menu->tearoff_window,
- "delete_event",
- G_CALLBACK (gtk_tearoff_menu_item_delete_cb),
- menu_item);
+ gtk_menu_set_tearoff_state (GTK_MENU (GTK_WIDGET (menu_item)->parent),
+ !menu->torn_off);
}
-}
+
+ gtk_widget_queue_resize (GTK_WIDGET (menu_item));
+ }
{
GtkMenuItem menu_item;
- guint torn_off : 1;
+ guint _gtk_reserved : 1;
};
struct _GtkTearoffMenuItemClass